package com.javaweb.searchengine.app.domain;

import java.util.List;

import org.apache.solr.client.solrj.beans.Field;
import org.springframework.data.annotation.Id;
import org.springframework.data.solr.core.geo.Point;
import org.springframework.data.solr.core.mapping.SolrDocument;

/**
 * 词条
 * @author 84649162@qq.com
 */
@SolrDocument(solrCoreName = "collection1")
public class SimpleEntry {

	@Id
	@Field
	private String id;

	@Field
	private String key;

	@Field
	private String explain;

	@Field("cat")
	private List<String> category;

	@Field("store")
	private Point location;

	public SimpleEntry() {
	}

	public SimpleEntry(String key, String explain) {
		super();
		this.key = key;
		this.explain = explain;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getExplain() {
		return explain;
	}

	public void setExplain(String explain) {
		this.explain = explain;
	}

	public List<String> getCategory() {
		return category;
	}

	public void setCategory(List<String> category) {
		this.category = category;
	}

	public Point getLocation() {
		return location;
	}

	public void setLocation(Point location) {
		this.location = location;
	}

	@Override
	public String toString() {
		return "SimpleEntry [key=" + key + ", explain=" + explain + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((explain == null) ? 0 : explain.hashCode());
		result = prime * result + ((key == null) ? 0 : key.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SimpleEntry other = (SimpleEntry) obj;
		if (explain == null) {
			if (other.explain != null)
				return false;
		} else if (!explain.equals(other.explain))
			return false;
		if (key == null) {
			if (other.key != null)
				return false;
		} else if (!key.equals(other.key))
			return false;
		return true;
	}
}
